
public class SimpleClass {
    // private instance fields salary and name
    private int salary;

    private String name;

    public static void main(java.lang.String[] args) 
    {

        // Creates an instance of this class and save the reference in a
        // variable
        SimpleClass sc = new SimpleClass();
        
        sc.name = "Jim";
        sc.salary = 30000;
        
        System.out.println(sc.name + "makes $" + sc.salary);

        // For the exercise on Methods:

        // Construct an instance, passing a name and a salary
        SimpleClass simple = new SimpleClass("Mary", 5000000);

        // Use the set methods to change the name and salary
        simple.setName("Mary Duncan");
        simple.setSalary(6000000);

        // Use the get methods to get the name and salary, and save in variables
        String name = simple.getName();
        int salary = simple.getSalary();

        // Print out the name and salary
        System.out.println("Name: " + name + " - Salary: " + salary);

        // verify the version of Java that is running
        System.out.println(System.getProperty("java.version"));
    }

    // For the exercise on Methods:

    public SimpleClass() {
    }

    public SimpleClass(String name) {
        this(name, 500);
    }

    public SimpleClass(String name, int salary) {
        this.name = name;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public int getSalary() {
        return salary;
    }

}
